<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
<script>
var today = new Date(); //新建一个Date对象
today=today.setDate(today.getDate()-1);
today=new Date(today);
var date = today.getDate();//查询当月日期
var day = today.getDay();//查询当前星期几
var month = today.getMonth()+1;//查询月份
var year = today.getFullYear();//查询年份
var hour=today.getHours();
var morning="";
if (hour>=8 & hour<=12) morning="	";
var week="";
let weekList = {
  0:'星期日',
  1:'星期一',
  2:'星期二',
  3:'星期三',
  4:'星期四',
  5:'星期五',
  6:'星期六'
}
week = weekList[day];
document.write(year+"年"+month+"月"+date+"日");
</script>
</body>
</html>